<?php
/**
 * KnifeCMS
 * ============================================================================
 * 版权所有 2005-2010 KnifeCMS，并保留所有权利。
 * 网站地址: http://www.knifecms.com；
 * ----------------------------------------------------------------------------
*/
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
/* 检查权限 */
admin_priv('shop_config');
/*------------------------------------------------------ */
//-- 验证码设置
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'main')
{
    if (gd_version() == 0)
    {
        sys_msg($_LANG['audit_note'], 1);
    }
    assign_query_info();
    $audit = $_CFG['audit'];
	//echo "sssssssssssssssssss:". $audit;
    $audit_check = array();
    if (strpos($audit,AUDIT_REGISTER)!==false)
    {
        $audit_check['register']          = 'checked="checked"';
    }
    if (strpos($audit,AUDIT_ARTICLE)!==false)
    {
        $audit_check['article']           = 'checked="checked"';
    }
    if (strpos($audit,AUDIT_COMMENT)!==false)
    {
        $audit_check['comment']           = 'checked="checked"';
    }
    if (strpos($audit,AUDIT_ADMIN)!==false)
    {
        $audit_check['admin']             = 'checked="checked"';
    }
    if (strpos($audit,AUDIT_MESSAGE)!==false)
    {
        $audit_check['message']    = 'checked="checked"';
    }
    $smarty->assign('audit',          $audit_check);
    $smarty->assign('ur_here',          $_LANG['audit_manage']);
    $smarty->display('audit_manage.htm');
}
/*------------------------------------------------------ */
//-- 保存设置
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'save_config')
{
    $audits = '';
    $audits .= empty($_POST['audit_register'])    ? '' : ',' . AUDIT_REGISTER;
    $audits .= empty($_POST['audit_article'])     ? '' : ',' . AUDIT_ARTICLE;
    $audits .= empty($_POST['audit_comment'])     ? '' : ',' . AUDIT_COMMENT;
    $audits .= empty($_POST['audit_admin'])       ? '' : ',' . AUDIT_ADMIN;
    $audits .= empty($_POST['audit_message'])     ? '' : ',' . AUDIT_MESSAGE;
	
    $sql = "UPDATE " . $ecs->table('shop_config') . " SET value='$audits' WHERE code='audit'";
    $db->query($sql);
    clear_cache_files();
    sys_msg($_LANG['save_ok'], 0, array(array('href'=>'audit_manage.php?act=main', 'text'=>$_LANG['audit_manage'])));
}
?>